#include "Ressources.h"


using namespace std;

bool Ressources::is_init = false;
SDL_Surface ** Ressources::images = new SDL_Surface*[24];

void Ressources::init()
{
	if (is_init == true) {
		return;
	}
	is_init = true;

	/**
	 * INITIALISATION DE TOUTES LES IMAGES
	 */
	Ressources::images[STABLE] = IMG_Load("ressources/images/stable.bmp");
    Ressources::images[MOUVHORI] = IMG_Load("ressources/images/mouv.bmp");
    Ressources::images[MOUVVERTI] = IMG_Load("ressources/images/mouv2.bmp");
    Ressources::images[PIEGE] = IMG_Load("ressources/images/piege.bmp");
    Ressources::images[DISPARAIT] = IMG_Load("ressources/images/disparait.bmp");
    Ressources::images[TEMPO] = IMG_Load("ressources/images/cubeTempo.bmp");
    Ressources::images[PIEGECASSE] = IMG_Load("ressources/images/casse.bmp");
    Ressources::images[FUSEE] = IMG_Load("ressources/images/fuseeA.bmp");
    Ressources::images[ANIMATION] = IMG_Load("ressources/images/sprit/explosion.png");
	SDL_SetColorKey( Ressources::images[ANIMATION], SDL_SRCCOLORKEY, SDL_MapRGB( Ressources::images[ANIMATION]->format, 255, 255, 255));
    Ressources::images[MONSTRE4] = IMG_Load("ressources/images/monstre4.bmp");
    Ressources::images[SOUCOUPE] = IMG_Load("ressources/images/soucoupe.png");
    Ressources::images[TIR] = IMG_Load("ressources/images/tir.bmp");
    Ressources::images[PROTECTION] = IMG_Load("ressources/images/protectionMini.png");
	Ressources::images[PROTECTION_PION] = IMG_Load("ressources/images/protection.png");
    Ressources::images[TROU] = IMG_Load("ressources/images/trou.bmp");

    Ressources::images[RESORTBAS] = IMG_Load("ressources/images/ressort.bmp");
    Ressources::images[RESORTHAUT] = IMG_Load("ressources/images/ressort2.bmp");

    Ressources::images[SUPERRESSORT] = IMG_Load("ressources/images/superResort.bmp");
	Ressources::images[SUPERRESSORT1] = IMG_Load("ressources/images/superResort1.bmp");
    Ressources::images[TRAMPO] = IMG_Load("ressources/images/trampo.bmp");

	Ressources::images[POD1] = IMG_Load("ressources/images/podium1.png");
    Ressources::images[POD2] = IMG_Load("ressources/images/podium2.png");
    Ressources::images[POD3] = IMG_Load("ressources/images/podium3.png");

	Ressources::images[FUSEE1_PION] = IMG_Load("ressources/images/fusee1.bmp");
	Ressources::images[FUSEE_PION] = IMG_Load("ressources/images/fusee.bmp");
	/**
	 * initialisation des polices 
	 */
	//Ressources::polices[ARIAL] = NULL;
	//Ressources::polices[ANGELINA] = NULL;

}

SDL_Surface* Ressources::get_image(enum type_image id) {
	init();
	return Ressources::images[id];
}